<template>
  <div class="app-container">
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span>时间：{{ this.info.dataTime }}</span>
      </div>
      <div id="print-div" class="mainBox" style="height: 1200px">
        <div
          style="
            text-align: center;
            font-size: 24px;
            font-weight: bold;
            margin-bottom: 10px;
          "
        >
          <img
            src="@/icons/img/changzhi.png"
            style="width: 30px; height: 30px"
          />{{ this.$store.state.City }}医院<br />
          血栓风险评分
        </div>
        <div class="warp">
          <div class="one">
            <div
              style="
                display: inline-flex;
                height: 30px;
                line-height: 30px;
                font-size: 14px;
                float: left;
                margin-left: 25px;
                margin-top: 4px;
              "
            >
              姓名：
              <span style="
                  width: 70px;
                  text-align: center;
                  border-bottom: 1px solid rgb(220, 222, 226);
                  height: 30px;
                  margin-right: 5px;
                "
              >{{ this.data.name }}</span>
              性别：
              <span
                style="
              width: 40px;
              text-align: center;
              border-bottom: 1px solid rgb(220, 222, 226);
              height: 30px;
              margin-right: 5px;
            "
              >{{ this.data.sex }}</span
              >
              年龄：
              <span style="
                    width: 60px;
                    text-align: center;
                    border-bottom: 1px solid rgb(220, 222, 226);
                    height: 30px;
                    margin-right: 5px;
                  "
              >{{ this.$store.state.user.severFall.ageOrMonthAge}}</span>
              床号：
              <span style="
              width: 60px;
              text-align: center;
              border-bottom: 1px solid rgb(220, 222, 226);
              height: 30px;
              margin-right: 5px;
            "
              >{{ this.data.bed_code }}</span>
              住院号：
              <span style="
              width: 150px;
              text-align: center;
              border-bottom: 1px solid rgb(220, 222, 226);
              height: 30px;
            "
              >{{ this.data.visit_id }}</span>
            </div>
          </div>
          <div class="two" style="height: 40px" id="select_div">
            <div class="long_divg" style="height: 40px">1分</div>
            <div class="long_divg" style="height: 40px">2分</div>
            <div class="long_divg" style="height: 40px">3分</div>
            <div class="long_divg" style="height: 40px">5分</div>
          </div>
          <div class="two" style="height: 30px" id="select_div">
            <div class="long_divluoxuanwan" style="height: 30px">
              1.年龄41-60岁
            </div>
            <div class="long_divluoxuanwan" style="height: 30px">
              16.年龄61-74岁
            </div>
            <div class="long_divluoxuanwan" style="height: 30px">
              23.年龄年75岁
            </div>
            <div class="long_divluoxuanwan" style="height: 30px">
              28.脑卒中（1个月）
            </div>
          </div>
          <div class="two" style="height: 60px" id="select_div">
            <div class="long_divluoxuanwans" style="height: 60px">
              2.肥胖(BMI^25Kg/m2)
            </div>
            <div class="long_divluoxuanwans" style="height: 60px">
              17.卧床＞3天，持续步行少于30步
            </div>
            <div class="long_divluoxuanwans" style="height: 60px">
              24. VTE家族史
            </div>
            <div class="long_divluoxuanwans" style="height: 60px">
              29.急性脊髓损伤（瘫痪）（1个月内）
            </div>
          </div>
          <div class="two" style="height: 60px" id="select_div">
            <div class="long_divluoxuanwans" style="height: 60px">
              3.卧床（V3天，持续步行少于30步）
            </div>
            <div class="long_divluoxuanwans" style="height: 60px">
              18.恶性肿瘤
            </div>
            <div class="long_divluoxuanwans" style="height: 60px">
              25.既往VTE病史
            </div>
            <div class="long_divluoxuanwans" style="height: 60px">
              30.择期髋或膝关节置换术
            </div>
          </div>
          <div class="two" style="height: 60px" id="select_div">
            <div class="long_divluoxuanwans" style="height: 60px">
              4.下肢肿胀
            </div>
            <div class="long_divluoxuanwans" style="height: 60px">
              19. PICC置管或CVC置管（一个月内或现在）
            </div>
            <div class="long_divluoxuanwans" style="height: 60px">
              26.肝素引起的血小板减少症
            </div>
            <div class="long_divluoxuanwans" style="height: 60px">
              31.髋关节、骨盆或下肢骨折，多发性创伤（1个月内）
            </div>
          </div>
          <div class="two" style="height: 120px" id="select_div">
            <div class="long_divluoxuanwans" style="height: 120px">
              5.下肢静脉曲张
            </div>
            <div class="long_divluoxuanwans" style="height: 120px">
              20.腹腔镜手术（＞45分钟）
            </div>
            <div class="long_divluoxuanwans" style="height: 120px">
              27.已知的血栓形成倾向（包括抗凝血酶缺
              陷症，蛋白C或S缺乏，LeidenV因子、凝血酶原G20210A突变，抗磷脂抗体阳性等）
            </div>
            <div class="long_divluoxuanwans" style="height: 120px"></div>
          </div>
          <div class="two" style="height: 60px" id="select_div">
            <div class="long_divluoxuanwans" style="height: 60px">
              6.炎性肠病（溃疡型结肠炎，克罗恩病）
            </div>
            <div class="long_divluoxuanwans" style="height: 60px">
              21.关节镜手术
            </div>
            <div class="long_divluoxuanwans" style="height: 60px"></div>
            <div class="long_divluoxuanwans" style="height: 60px"></div>
          </div>
          <div class="two" style="height: 30px" id="select_div">
            <div class="long_divluoxuanwan" style="height: 30px">
              7.急性心肌梗死（一个月内）
            </div>
            <div class="long_divluoxuanwan" style="height: 30px">
              22.其他大手术（＞45分钟）
            </div>
            <div class="long_divluoxuanwan" style="height: 30px"></div>
            <div class="long_divluoxuanwan" style="height: 30px"></div>
          </div>
          <div class="two" style="height: 30px" id="select_div">
            <div class="long_divluoxuanwan" style="height: 30px">
              8.充血性心力衰竭（一个月内）
            </div>
            <div class="long_divluoxuanwan" style="height: 30px"></div>
            <div class="long_divluoxuanwan" style="height: 30px"></div>
            <div class="long_divluoxuanwan" style="height: 30px"></div>
          </div>
          <div class="two" style="height: 30px" id="select_div">
            <div class="long_divluoxuanwan" style="height: 30px">
              9.脓毒症（一个月内或现在）
            </div>
            <div class="long_divluoxuanwan" style="height: 30px"></div>
            <div class="long_divluoxuanwan" style="height: 30px"></div>
            <div class="long_divluoxuanwan" style="height: 30px"></div>
          </div>
          <div class="two" style="height: 30px" id="select_div">
            <div class="long_divluoxuanwan" style="height: 30px">
              10.手术时间V45 min
            </div>
            <div class="long_divluoxuanwan" style="height: 30px"></div>
            <div class="long_divluoxuanwan" style="height: 30px"></div>
            <div class="long_divluoxuanwan" style="height: 30px"></div>
          </div>
          <div class="two" style="height: 60px" id="select_div">
            <div class="long_divluoxuanwans" style="height: 60px">
              11.严重的肺部疾病（COPD,肺气肿）
            </div>
            <div class="long_divluoxuanwans" style="height: 60px"></div>
            <div class="long_divluoxuanwans" style="height: 60px"></div>
            <div class="long_divluoxuanwans" style="height: 60px"></div>
          </div>
          <div class="two" style="height: 30px" id="select_div">
            <div class="long_divluoxuanwan" style="height: 30px">
              12.肺功能异常(FEVl%<50%)
            </div>
            <div class="long_divluoxuanwan" style="height: 30px"></div>
            <div class="long_divluoxuanwan" style="height: 30px"></div>
            <div class="long_divluoxuanwan" style="height: 30px"></div>
          </div>
          <div class="two" style="height: 30px" id="select_div">
            <div class="long_divluoxuanwan" style="height: 30px">
              13.妊娠或产褥期
            </div>
            <div class="long_divluoxuanwan" style="height: 30px"></div>
            <div class="long_divluoxuanwan" style="height: 30px"></div>
            <div class="long_divluoxuanwan" style="height: 30px"></div>
          </div>
          <div class="two" style="height: 30px" id="select_div">
            <div class="long_divluoxuanwan" style="height: 30px">
              14.服用避孕药或雌激素替代治疗
            </div>
            <div class="long_divluoxuanwan" style="height: 30px"></div>
            <div class="long_divluoxuanwan" style="height: 30px"></div>
            <div class="long_divluoxuanwan" style="height: 30px"></div>
          </div>
          <div class="two" style="height: 30px" id="select_div">
            <div class="long_divluoxuanwan" style="height: 30px">
              15.不明原因反复流产史
            </div>
            <div class="long_divluoxuanwan" style="height: 30px"></div>
            <div class="long_divluoxuanwan" style="height: 30px"></div>
            <div class="long_divluoxuanwan" style="height: 30px"></div>
          </div>
          <div class="two" style="height: 30px" id="select_div">
            <div class="long_divluoxuanwan" style="height: 30px">日期</div>
            <div class="long_divhaohuoqiu" style="height: 30px">危险因素</div>
            <div class="long_divhaohuoqiut" style="height: 30px">总分</div>
            <div class="long_divhaohuoqius" style="height: 30px">签名</div>
          </div>
          <div class="two" style="height: 30px" id="select_div">
            <div class="long_divluoxuanwan" style="height: 30px">
              <el-date-picker
                v-model="info.timejizai"
                class="tianji"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd"
                type="date"
                placeholder="选择日期时间"
                @change="timechange(time)"
              >
              </el-date-picker>
            </div>
            <div class="long_divhaohuoqiu" style="height: 30px">
              <el-select
                v-model="info.timejizaione"
                placeholder="请选择"
                class="timejizaione"
                multiple
              >
                <el-option
                  v-for="item in selectarr"
                  :key="item.id"
                  :label="item.label"
                  :value="item.label"
                >
                  {{ item.label }}&nbsp;{{ item.value }}
                </el-option>
              </el-select>
            </div>
            <div class="long_divhaohuoqiut" style="height: 30px">
              <el-input v-model="info.timejizaithree" class="tiwen"></el-input>
            </div>
            <div class="long_divhaohuoqius" style="height: 30px">
              <el-select
                v-model="info.timejizaifour"
                placeholder="请选择"
                class="timejizaitwo"
                filterable
                remote
                :remote-method="remoteMethod"
                :loading="selectLoading"
              >
                <el-option
                  v-for="item in arr"
                  :key="item.id"
                  :label="item.user_name"
                  :value="item.login_name"
                ></el-option>
              </el-select>
            </div>
          </div>
          <div class="two" style="height: 30px" id="select_div">
            <div class="long_divluoxuanwan" style="height: 30px">
              <el-date-picker
                v-model="info.timejizait"
                class="tianji"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd"
                type="date"
                placeholder="选择日期时间"
                @change="timechange(time)"
              >
              </el-date-picker>
            </div>
            <div class="long_divhaohuoqiu" style="height: 30px">
              <el-select
                v-model="info.timejizaionet"
                placeholder="请选择"
                class="timejizaione"
                multiple
              >
                <el-option
                  v-for="item in selectarr"
                  :key="item.id"
                  :label="item.label"
                  :value="item.label"
                  >{{ item.label }}&nbsp;{{ item.value }}</el-option
                >
              </el-select>
            </div>
            <div class="long_divhaohuoqiut" style="height: 30px">
              <el-input v-model="info.timejizaithreet" class="tiwen"></el-input>
            </div>
            <div class="long_divhaohuoqius" style="height: 30px">
              <el-select
                v-model="info.timejizaifourt"
                placeholder="请选择"
                class="timejizaitwo"
                filterable
                remote
                :remote-method="remoteMethod"
                :loading="selectLoading"
              >
                <el-option
                  v-for="item in arr"
                  :key="item.id"
                  :label="item.user_name"
                  :value="item.login_name"
                ></el-option>
              </el-select>
            </div>
          </div>
          <div class="two" style="height: 30px" id="select_div">
            <div class="long_divluoxuanwan" style="height: 30px">
              <el-date-picker
                v-model="info.timejizaiy"
                class="tianji"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd"
                type="date"
                placeholder="选择日期时间"
                @change="timechange(time)"
              >
              </el-date-picker>
            </div>
            <div class="long_divhaohuoqiu" style="height: 30px">
              <el-select
                v-model="info.timejizaioney"
                placeholder="请选择"
                class="timejizaione"
                multiple
              >
                <el-option
                  v-for="item in selectarr"
                  :key="item.id"
                  :label="item.label"
                  :value="item.label"
                  >{{ item.label }}&nbsp;{{ item.value }}</el-option
                >
              </el-select>
            </div>
            <div class="long_divhaohuoqiut" style="height: 30px">
              <el-input v-model="info.timejizaithreey" class="tiwen"></el-input>
            </div>
            <div class="long_divhaohuoqius" style="height: 30px">
              <el-select
                v-model="info.timejizaifoury"
                placeholder="请选择"
                class="timejizaitwo"
                filterable
                remote
                :remote-method="remoteMethod"
                :loading="selectLoading"
              >
                <el-option
                  v-for="item in arr"
                  :key="item.id"
                  :label="item.user_name"
                  :value="item.login_name"
                ></el-option>
              </el-select>
            </div>
          </div>
          <div class="two" style="height: 30px" id="select_div">
            <div class="long_divluoxuanwan" style="height: 30px">
              <el-date-picker
                v-model="info.timejizaiu"
                class="tianji"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd"
                type="date"
                placeholder="选择日期时间"
                @change="timechange(time)"
              >
              </el-date-picker>
            </div>
            <div class="long_divhaohuoqiu" style="height: 30px">
              <el-select
                v-model="info.timejizaioneu"
                placeholder="请选择"
                class="timejizaione"
                multiple
              >
                <el-option
                  v-for="item in selectarr"
                  :key="item.id"
                  :label="item.label"
                  :value="item.label"
                  >{{ item.label }}&nbsp;{{ item.value }}</el-option
                >
              </el-select>
            </div>
            <div class="long_divhaohuoqiut" style="height: 30px">
              <el-input v-model="info.timejizaithreeu" class="tiwen"></el-input>
            </div>
            <div class="long_divhaohuoqius" style="height: 30px">
              <el-select
                v-model="info.timejizaifouru"
                placeholder="请选择"
                class="timejizaitwo"
                filterable
                remote
                :remote-method="remoteMethod"
                :loading="selectLoading"
              >
                <el-option
                  v-for="item in arr"
                  :key="item.id"
                  :label="item.user_name"
                  :value="item.login_name"
                ></el-option>
              </el-select>
            </div>
          </div>
          <div class="two" style="height: 30px" id="select_div">
            <div class="long_divluoxuanwan" style="height: 30px">
              <el-date-picker
                v-model="info.timejizaii"
                class="tianji"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd"
                type="date"
                placeholder="选择日期时间"
                @change="timechange(time)"
              >
              </el-date-picker>
            </div>
            <div class="long_divhaohuoqiu" style="height: 30px">
              <el-select
                v-model="info.timejizaionei"
                placeholder="请选择"
                class="timejizaione"
                multiple
              >
                <el-option
                  v-for="item in selectarr"
                  :key="item.id"
                  :label="item.label"
                  :value="item.label"
                  >{{ item.label }}&nbsp;{{ item.value }}</el-option
                >
              </el-select>
            </div>
            <div class="long_divhaohuoqiut" style="height: 30px">
              <el-input v-model="info.timejizaithreei" class="tiwen"></el-input>
            </div>
            <div class="long_divhaohuoqius" style="height: 30px">
              <el-select
                v-model="info.timejizaifouri"
                placeholder="请选择"
                class="timejizaitwo"
                filterable
                remote
                :remote-method="remoteMethod"
                :loading="selectLoading"
              >
                <el-option
                  v-for="item in arr"
                  :key="item.id"
                  :label="item.user_name"
                  :value="item.login_name"
                ></el-option>
              </el-select>
            </div>
          </div>
          <div class="two" style="height: 30px" id="select_div">
            <div class="long_divluoxuanwan" style="height: 30px">
              Caprini评分
            </div>
            <div class="long_divhaohuoqiuttt" style="height: 30px">
              危险等级
            </div>
            <div class="long_divhaohuoqiuqqqq" style="height: 30px">
              推荐的预防方案
            </div>
          </div>
          <div class="two" style="height: 30px" id="select_div">
            <div class="long_divluoxuanwan" style="height: 30px">0-2分</div>
            <div class="long_divhaohuoqiuttt" style="height: 30px">低危</div>
            <div class="long_divhaohuoqiuqqqq" style="height: 30px">
              基础预防
            </div>
          </div>
          <div class="two" style="height: 30px" id="select_div">
            <div class="long_divluoxuanwan" style="height: 30px">3-4分</div>
            <div class="long_divhaohuoqiuttt" style="height: 30px">中危</div>
            <div class="long_divhaohuoqiuqqqq" style="height: 30px">
              基础预防、物理预防和（或）药物预防
            </div>
          </div>
          <div class="two" style="height: 30px" id="select_div">
            <div class="long_divluoxuanwan" style="height: 30px">5分</div>
            <div class="long_divhaohuoqiuttt" style="height: 30px">高危</div>
            <div class="long_divhaohuoqiuqqqq" style="height: 30px">
              基础预防、物理预防和药物预防
            </div>
          </div>
        </div>
        <div style="text-align: center; margin-top: 1px">
          第{{ this.pageNum }}页
        </div>
      </div>
      <div
        style="
          position: fixed;
          right: 0;
          bottom: 0;
          z-index: 9;
          width: 100%;
          height: 56px;
          line-height: 56px;
          padding: 0 60px 0 18px;
          background: #fff;
          border-top: 1px solid #e8eaec;
          box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.03);
        "
      >
        <el-button
          type="primary"
          style="position: absolute; right: 20px; top: 8px"
          @click="btn"
          :disabled=garbage
          >保存</el-button
        >

        <el-button
          type="primary"
          style="position: absolute; right: 102px; top: 8px"
          @click="daying"
          :disabled=garbage
          >打印</el-button
        >
        <el-button
          type="primary"
          style="position: absolute; right: 185px; top: 8px"
          @click="reload"
          :disabled=garbage
          >刷新</el-button
        >

        <el-button
          type="primary"
          style="position: absolute; right: 270px; top: 8px"
          @click="histion()"
          :disabled=garbage
          >历史记录</el-button
        >
        <span style="position: absolute; right: 500px; top: 1px">
          设置页码：
          <input
            v-model="pageNum"
            autocomplete="off"
            spellcheck="false"
            type="text"
            placeholder=""
            oninput="value=value.replace(/[^0-9.]/g,'')"
            style="width: 100px; height: 30px"
          />
        </span>
      </div>
      <el-drawer title="评估列表" :visible.sync="table" direction="rtl">
        <el-table :data="gridData">
          <el-table-column
            label="序号"
            type="index"
            align="center"
            width="80"
          />
          <el-table-column
            property="createTime"
            label="评估时间"
            width="150"
            align="center"
          />
          <el-table-column
            property="operatorCode"
            label="评估人"
            width="150"
            align="center"
          />
          <el-table-column label="操作" width="154" align="center">
            <template slot-scope="scope">
              <el-button
                slot="reference"
                size="mini"
                style="margin-left: 10px"
                type="primary"
                @click="choice(scope)"
                >选择</el-button
              >
              <el-popover
                :ref="`popover-${scope.$index}`"
                trigger="click"
                placement="top"
                width="100"
              >
                <p class="el-icon-warning">确定删除</p>
                <div style="text-align: right; margin: 0">
                  <el-button size="mini" type="text" @click="no(scope)"
                    >取消</el-button
                  >
                  <el-button type="primary" size="mini" @click="yes(scope)"
                    >确定</el-button
                  >
                </div>
                <el-button
                  slot="reference"
                  size="mini"
                  style="margin-left: 10px"
                  type="danger"
                  >删除</el-button
                >
              </el-popover>
            </template>
          </el-table-column>
        </el-table>
      </el-drawer>
    </el-card>
  </div>
</template>

<script>
import { printExcel } from "@/utils/config"; // 导入模块
import { jyxdPagePrint } from "@/utils/jyxd-page-printer.js";
import {
  patientgetList,
  ADLInsertAndUpdate,
  ADLDelete,
  queryDataADL,
  queryADLList,
  getUserListByUserType,
  usergetList, findPage, getUserListByUserTypegetNurseList,
} from "@/api/table";
import { Message } from "element-ui";
import { edit } from "../../api/table";
export default {
  data() {
    return {
      pageNum: 1,
      printParam: {
        print_id: "print-div", //完整打印区域最外包裹, id名
        paper_height: "1240", //纸张长度，目前不自动分页，页面代码自行设计分页模式
        paper_width: "850", //纸张宽度，根据横向纵向调整，影响页面折行效果
        preview: "",
      },
      garbage: false,
      gridData: [],
      selectLoading: false,
      age: "",
      data: [],
      arr: [],
      selectarr: [
        { id: 1, label: "1", value: "年龄41-60岁" },
        { id: 2, label: "2", value: "肥胖(BMI^25Kg/m2)" },
        { id: 3, label: "3", value: "卧床（V3天，持续步行少于30步）" },
        { id: 4, label: "4", value: "下肢肿胀" },
        { id: 5, label: "5", value: "下肢静脉曲张" },
        { id: 6, label: "6", value: "炎性肠病（溃疡型结肠炎，克罗恩病）" },
        { id: 7, label: "7", value: "急性心肌梗死（一个月内）" },
        { id: 8, label: "8", value: "充血性心力衰竭（一个月内）" },
        { id: 9, label: "9", value: "脓毒症（一个月内或现在）" },
        { id: 10, label: "10", value: "手术时间V45 min" },
        { id: 11, label: "11", value: "严重的肺部疾病（COPD,肺气肿）" },
        { id: 12, label: "12", value: "肺功能异常(FEVl%<50%)" },
        { id: 13, label: "13", value: "妊娠或产褥期" },
        { id: 14, label: "14", value: "服用避孕药或雌激素替代治疗" },
        { id: 15, label: "15", value: "不明原因反复流产史" },
        { id: 16, label: "16", value: "年龄61-74岁" },
        { id: 17, label: "17", value: "卧床＞3天，持续步行少于30步" },
        { id: 18, label: "18", value: "恶性肿瘤" },
        { id: 19, label: "19", value: "PICC置管或CVC置管（一个月内或现在）" },
        { id: 20, label: "20", value: "腹腔镜手术（＞45分钟）" },
        { id: 21, label: "21", value: "关节镜手术" },
        { id: 22, label: "22", value: "其他大手术（＞45分钟）" },
        { id: 23, label: "23", value: "年龄年75岁" },
        { id: 24, label: "24", value: "VTE家族史" },
        { id: 25, label: "25", value: "既往VTE病史" },
        { id: 26, label: "26", value: "肝素引起的血小板减少症" },
        {
          id: 27,
          label: "27",
          value:
            "已知的血栓形成倾向（包括抗凝血酶缺 陷症，蛋白C或S缺乏，LeidenV因子、凝血酶原G20210A突变，抗磷脂抗体阳性等）",
        },
        { id: 28, label: "28", value: "脑卒中（1个月）" },
        { id: 29, label: "29", value: "急性脊髓损伤（瘫痪）（1个月内）" },
        { id: 30, label: "30", value: "择期髋或膝关节置换术" },
        {
          id: 31,
          label: "31",
          value: "髋关节、骨盆或下肢骨折，多发性创伤（1个月内）",
        },
      ],
      table: false,
      info: {
        timejizai: "",
        timejizaione: [],
        timejizaithree: "",
        timejizaifour: "",

        timejizait: "",
        timejizaionet: [],
        timejizaithreet: "",
        timejizaifourt: "",

        timejizaiy: "",
        timejizaioney: [],
        timejizaithreey: "",
        timejizaifoury: "",

        timejizaiu: "",
        timejizaioneu: [],
        timejizaithreeu: "",
        timejizaifouru: "",

        timejizaii: "",
        timejizaionei: [],
        timejizaithreei: "",
        timejizaifouri: "",
        type: "pfit_jizai",
        dataTime: "",
        patientId: "",
      },
      code1: 0,
      code2: 0,
      code3: 0,
      code4: 0,
      scoreList: [
        {
          id: "0",
          value: "0",
          label: "0",
        },
        {
          id: "1",
          value: "1",
          label: "1",
        },
        {
          id: "2",
          value: "2",
          label: "2",
        },
        {
          id: "3",
          value: "3",
          label: "3",
        },
      ],
    };
  },
  computed: {
    getData() {
      return this.$store.state.user.severFall;
    },
  },
  watch: {
    getData: {
      handler(nVal) {
        this.data = this.$store.state.user.severFall;
        if (this.$store.state.user.severFall == undefined) {
          this.$message({
            message: "请先选择病人",
            type: "warning",
          });
        } else {
          this.huli();
        }
      },
      deep: true,
    },
  },
  created() {
    getUserListByUserTypegetNurseList({
      deptCode: this.$store.state.user.loginInfo.deptCode
    }).then((res) => {
      this.arr = res.data;
    });
    this.data = this.$store.state.user.severFall;
    patientgetList({ visitId: this.data.visit_id }).then((res) => {
      if (res.data[0].age !== "") {
        this.age = res.data[0].age;
      }
    });
  },

  mounted() {
    this.data = this.$store.state.user.severFall;
    if (
      typeof this.data.patient_id != "string" ||
      this.data.patient_id.length < 1
    ) {
      alert("请选择一次病人");
    } else {
      this.huli();
    }
    patientgetList({ visitId: this.data.visit_id }).then((res) => {
      if (res.data[0].age !== "") {
        this.age = res.data[0].age;
      }
    });
  },
  methods: {
    //设置页码
    findPageByPatientId(){
      findPage({
        patientId: this.data.patient_id,
      }).then((res) => {
        if(res.data!=null  &&　res.data.length>0){
          this.pageNum=res.data[0].pageNum;
        }else{
          this.pageNum=1;
        }
      });

    },
    huli() {
      this.data = this.$store.state.user.severFall;
      this.info.patientId = this.data.patient_id;
      this.info = {
        timejizai: "",
        timejizaione: [],
        timejizaithree: "",
        timejizaifour: "",

        timejizait: "",
        timejizaionet: [],
        timejizaithreet: "",
        timejizaifourt: "",

        timejizaiy: "",
        timejizaioney: [],
        timejizaithreey: "",
        timejizaifoury: "",

        timejizaiu: "",
        timejizaioneu: [],
        timejizaithreeu: "",
        timejizaifouru: "",

        timejizaii: "",
        timejizaionei: [],
        timejizaithreei: "",
        timejizaifouri: "",
        type: "pfit_jizai",
        dataTime: "",
        patientId: "",
      };
      this.code1 = 0;
      this.code2 = 0;
      this.code3 = 0;
      this.code4 = 0;
      this.getNowDate();
      if (
        this.data.unplanned == "" ||
        this.data.unplanned == null ||
        this.data.unplanned == 0
      ) {
        this.garbage = true;
        alert('请在首页补全患者信息')
        // this.$message({
        //   message: "请在首页补全患者信息",
        //   type: "warning",
        //   duration: 1500,
        // });
        return;
      } else {
        this.garbage = false;
      }
      this.findPageByPatientId();
    },
    remoteMethod(query) {
      if (query !== "") {
        let callBackArr = [];
        this.selectLoading = true;
        usergetList({
          workNumber: query,
        }).then((res) => {
          this.selectLoading = false;
          this.arr = res.data;
        });
      }
    },
    sum(type, value) {
      console.log(this.code1, "1111111111111");
      console.log(this.code2, "222222222222");
      console.log(this.code3, "333333333333333");
      console.log(this.code4, "44444444444444");
      var codeValue = value;
      if (type.indexOf("code1") != -1) {
        this.code1 = codeValue;
      } else if (type.indexOf("code2") != -1) {
        this.code2 = codeValue;
      } else if (type.indexOf("code3") != -1) {
        this.code3 = codeValue;
      } else if (type.indexOf("code4") != -1) {
        this.code4 = codeValue;
      }
      this.info.score =
        Number(this.setValue(this.code1)) +
        Number(this.setValue(this.code2)) +
        Number(this.setValue(this.code3)) +
        Number(this.setValue(this.code4));
    },
    //赋值0
    setValue(val) {
      if (val == "") {
        val = 0;
      }
      return val;
    },
    getNowDate() {
      var date = new Date();
      // 年
      var year = date.getFullYear();
      // 月
      var month = date.getMonth() + 1;
      // 日
      var day = date.getDate();
      // 时
      var hh = date.getHours();
      // 分
      var mm = date.getMinutes();
      // 秒
      var ss = date.getSeconds();
      if (Number(month) < 10) {
        month = "0" + month;
      }
      if (Number(day) < 10) {
        day = "0" + day;
      }
      if (Number(hh) < 10) {
        hh = "0" + hh;
      }
      if (Number(mm) < 10) {
        mm = "0" + mm;
      }
      if (Number(ss) < 10) {
        ss = "0" + ss;
      }
      this.info.dataTime =
        year + "-" + month + "-" + day + " " + hh + ":" + mm + ":" + ss;
    },
    //打印
    daying() {
      if (
        typeof this.data.patient_id != "string" ||
        this.data.patient_id.length < 1
      ) {
        alert("请选择一次病人");
      } else {
        jyxdPagePrint(this.printParam);
      }
    },
    //保存
    btn() {
      if (
        typeof this.data.patient_id != "string" ||
        this.data.patient_id.length < 1
      ) {
        alert("请选择一次病人");
      } else {
        if (!this.info.patientId) {
          this.info.patientId = this.data.patient_id;
        }
        const info = JSON.parse(JSON.stringify(this.info));
        info.timejizaione = info.timejizaione.join(",");
        info.timejizaionet = info.timejizaionet.join(",");
        info.timejizaioney = info.timejizaioney.join(",");
        info.timejizaioneu = info.timejizaioneu.join(",");
        info.timejizaionei = info.timejizaionei.join(",");
        ADLInsertAndUpdate(info).then((res) => {
          if (res.code === 200) {
            this.$message({
              message: "保存成功",
              type: "success",
              duration: 1500,
            });
          } else {
            this.$message({
              message: "保存失败",
              type: "warning",
              duration: 1500,
            });
          }
        });
      }
    },
    // 刷新
    reload() {
      if (
        typeof this.data.patient_id != "string" ||
        this.data.patient_id.length < 1
      ) {
        alert("请选择一次病人");
      } else {
        this.huli();
      }
    },
    //查看历史记录
    histion() {
      if (
        typeof this.data.patient_id != "string" ||
        this.data.patient_id.length < 1
      ) {
        alert("请选择一次病人");
      } else {
        this.table = true;
        if (this.data.patient_id) {
          queryADLList({
            type: "pfit_jizai",
            patientId: this.data.patient_id,
          }).then((res) => {
            this.gridData = res.data;
          });
        }
      }
    },
    // 选择
    choice(scope) {
      const ids = scope.row.rowId;
      queryDataADL({
        status: 1,
        patientId: this.data.patient_id,
        rowId: ids,
        type: "pfit_jizai",
      }).then((res) => {
        console.log(res.data);
        if (res.code === 200) {
          this.info = res.data;
          this.info.timejizaione = this.info.timejizaione.split(",");
          console.log(this.info.timejizaione, "睡吧");
          this.info.timejizaionet = this.info.timejizaionet.split(",");
          this.info.timejizaioney = this.info.timejizaioney.split(",");
          this.info.timejizaioneu = this.info.timejizaioneu.split(",");
          this.info.timejizaionei = this.info.timejizaionei.split(",");
          this.code1 = res.data.code1;
          this.code2 = res.data.code2;
          this.code3 = res.data.code3;
          this.code4 = res.data.code4;
          this.$message({
            message: "选择成功",
            type: "success",
            duration: 1500,
          });
        } else {
          this.$message({
            message: "选择失败",
            type: "warning",
            duration: 1500,
          });
        }
      });
    },
    //删除
    yes(scope) {
      ADLDelete({
        rowId: scope.row.rowId,
      }).then((res) => {
        this.$message({
          message: "删除成功",
          type: "success",
          duration: 1500,
        });
        this.histion();
      });
      scope._self.$refs[`popover-${scope.$index}`].doClose();
    },
    //取消删除
    no(scope) {
      this.$message("取消删除");
      scope._self.$refs[`popover-${scope.$index}`].doClose();
    },
  },
};
</script>

<style scoped>
::v-deep .el-tag .el-icon-close {
  width: 0;
  height: 0;
  display: none;
}
::v-deep .el-tag .el-icon-close::before {
  width: 0;
  height: 0;
  display: none;
}
::v-deep .el-tag--small {
  padding: 0;
  color: black;
}
::v-deep .el-input__icon {
  line-height: 32px !important;
}
::v-deep .el-input__inner {
  height: 23px !important;
  width: 100%;
  padding-left: 2px;
}
::v-deep .el-input__prefix {
  display: none;
}
::v-deep .el-input__suffix {
  display: none;
}
::v-deep .el-input__icon.el-icon-time {
  display: none;
  width: 0;
  height: 0;
}
::v-deep .el-select__caret.el-input__icon.el-icon-arrow-up {
  display: none;
  width: 0;
  height: 0;
}
::v-deep .el-select__tags {
  margin-top: -5px;
}
.tiwen {
  border: none;
  border-bottom: 1px solid #808695;
}
.warp {
  width: 940px;
  height: auto;
  border: 1px solid #808695;
  margin: 0 auto;
}
.one {
  width: 940px;
  height: 50px;
  border-bottom: 1px solid #808695;
}
.one /deep/ .el-input__inner {
  width: 50px !important;
}
.two {
  width: 940px;
  height: 120px;
  border-bottom: 1px solid #808695;
}
.two /deep/ .el-input__inner {
  border: none;
  width: 120px;
  float: left;
  text-align: center;
  margin-top: -12px;
}

.one /deep/ .el-input__inner {
  border: none;
  width: 120px;
}
/deep/.el-radio__input.el-radio__inner {
  margin-left: 0px;
}
.short_div {
  width: 140px;
  height: 120px;
  line-height: 20px;
  border-right: 1px solid #808695;
  float: left;
  padding-top: 15px;
  text-align: center;
}
.long_div {
  width: 240px;
  height: 120px;
  line-height: 30px;
  border-right: 1px solid #808695;
  float: left;
  padding-top: 15px;
  text-align: center;
}
.long_divg {
  width: 235px;
  height: 320px;
  line-height: 10px;
  border-right: 1px solid #808695;
  float: left;
  padding-top: 15px;
  text-align: center;
}
.long_divluoxuanwan {
  width: 235px;
  height: 320px;
  line-height: 1px;
  border-right: 1px solid #808695;
  float: left;
  padding-top: 15px;
  text-align: center;
}
.long_divhaohuoqiu {
  width: 400px;
  height: 320px;
  line-height: 1px;
  border-right: 1px solid #808695;
  float: left;
  padding-top: 15px;
  text-align: center;
}
.long_divhaohuoqiuqqqq {
  width: 470px;
  height: 320px;
  line-height: 1px;
  border-right: 1px solid #808695;
  float: left;
  padding-top: 15px;
  text-align: center;
}
.long_divhaohuoqiut {
  width: 135px;
  height: 320px;
  line-height: 1px;
  border-right: 1px solid #808695;
  float: left;
  padding-top: 15px;
  text-align: center;
}
.long_divhaohuoqiuttt {
  width: 235px;
  height: 320px;
  line-height: 1px;
  border-right: 1px solid #808695;
  float: left;
  padding-top: 15px;
  text-align: center;
}
.long_divhaohuoqius {
  width: 170px;
  height: 320px;
  line-height: 1px;
  border-right: 1px solid #808695;
  float: left;
  padding-top: 15px;
  text-align: center;
}
.long_divluoxuanwans {
  width: 235px;
  height: 320px;
  line-height: 20px;
  border-right: 1px solid #808695;
  float: left;
  padding-top: 15px;
  text-align: center;
}
.longer_div {
  width: 700px;
  height: 120px;
  line-height: 30px;
  border-right: 1px solid #808695;
  float: left;
  padding-top: 15px;
  text-align: center;
}
#select_div /deep/ input.el-input__inner {
  width: 220px;
  height: 15px;
}
#select_div /deep/ .timejizaione .el-input__inner {
  width: 350px;
  height: 15px;
}
#select_div /deep/ .timejizaitwo .el-input__inner {
  width: 160px;
  height: 15px;
}
#select_div /deep/ .tianji .el-input__inner {
  width: 220px;
  height: 15px;
}
#select_div /deep/ .tiwen .el-input__inner {
  width: 130px;
  height: 15px;
}
#select_div /deep/ .el-icon-arrow-up:before {
  content: "";
}
</style>

